<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/default.xhtml">
	<ui:define name="content">
		<h1>Spendenliste 
			"<h:outputText value="#{spendeListController.aktion.name}" />"
		</h1>
		<p:panel header="Kontoverbindung für die Aktion">
			<h:panelGrid columns="2">
				<h:outputLabel id="kontoinhaber" value="Kontoinhaber:" />
				<h:outputText value="#{spendeListController.aktion.konto.name}" /> 
				<h:outputLabel id="kontonummer" value="Kontonummer:" />
				<h:outputText value="#{spendeListController.aktion.konto.kontoNr}" /> 
				<h:outputLabel id="blz" value="Bankleitzahl:" />
				<h:outputText value="#{spendeListController.aktion.konto.blz}" /> 
				<h:outputLabel id="instname" value="Name der Bank:" />
				<h:outputText value="#{spendeListController.aktion.konto.nameDerBank}" /> 
			</h:panelGrid>
		</p:panel>		
		<br />
		<h:form>
			<p:panel header="Spenden">
				<p:dataTable id="spenden" value="#{spendeListController.aktion.spenden}" var="spende" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15">
				<p:column>
					<p:commandButton onclick="deleteConfirmation.show()" actionListener="#{spendeListController.doPrepareDelete(spende)}" icon="ui-icon-trash" />
				</p:column>
			          <p:column>
			            <f:facet name="header">
			              <h:outputText value="ID" />
			            </f:facet>
			            <h:outputText value="#{spende.id}" />
			          </p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Name" />
						</f:facet>
						<h:outputText value="#{spende.konto.name}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Konto-Nr" />
						</f:facet>
						<h:outputText value="#{spende.konto.kontoNr}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="BLZ" />
						</f:facet>
						<h:outputText value="#{spende.konto.blz}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Name der Bank" />
						</f:facet>
						<h:outputText value="#{spende.konto.nameDerBank}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Spendenbetrag" />
						</f:facet>
						<h:outputText value="#{spende.betrag}">
							<f:convertNumber type="currency" currencyCode="EUR" />
						</h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Quittung" />
						</f:facet>
						<h:outputText value="#{spende.quittung ? 'ja' : 'nein'}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="Status" />
						</f:facet>
						<h:outputText value="#{spende.statusAsText}" />
					</p:column>
				</p:dataTable>
				</p:panel>
			<br />
			<p:separator />
			<p:commandButton action="#{spendeListController.doBack}" value="Zurück" ajax="false" />
			<p:commandButton action="#{spendeListController.doRefresh}" value="Aktualisieren" ajax="false" />
			<p:confirmDialog message="#{messages['spendeList.spende.delete.confirmDialog.message']}" header="#{messages['spendeList.spende.delete.confirmDialog.header']}" severity="alert" widgetVar="deleteConfirmation">
				<p:commandButton value="#{messages['spendeList.spende.delete.confirmDialog.yes']}" onclick="deleteConfirmation.hide()" actionListener="#{spendeListController.doCommitDelete}" update="spenden"/>
				<p:commandButton value="#{messages['spendeList.spende.delete.confirmDialog.no']}" onclick="deleteConfirmation.hide()" />
			</p:confirmDialog>
		</h:form>
	</ui:define>
</ui:composition>